From: Claudio Cambra Date: Wed, 26 Mar 2025 09:25:58 +0000 (+0100) Subject: gui/macOS: Ensure file provider domain progress instances are correctly retained X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2^2~66^2~1 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success/%22http:/www.example.com/cgi/success?a=commitdiff_plain;h=67dcca0adbdde919b645124745aa8987e1c6eea2;p=nextcloud-desktop.git gui/macOS: Ensure file provider domain progress instances are correctly retained Signed-off-by: Claudio Cambra --- diff --git a/src/gui/macOS/progressobserver.m b/src/gui/macOS/progressobserver.m index b52e13b26..f6b6aaad0 100644 --- a/src/gui/macOS/progressobserver.m +++ b/src/gui/macOS/progressobserver.m @@ -21,6 +21,7 @@ self = [super init]; if (self) { _progress = progress; + [_progress retain]; [_progress addObserver:self forKeyPath:@"totalUnitCount" options:NSKeyValueObservingOptionNew context:nil]; [_progress addObserver:self forKeyPath:@"completedUnitCount" options:NSKeyValueObservingOptionNew context:nil]; [_progress addObserver:self forKeyPath:@"cancelled" options:NSKeyValueObservingOptionNew context:nil]; @@ -31,6 +32,18 @@ return self; } +- (void)dealloc +{ + [_progress removeObserver:self forKeyPath:@"totalUnitCount"]; + [_progress removeObserver:self forKeyPath:@"completedUnitCount"]; + [_progress removeObserver:self forKeyPath:@"cancelled"]; + [_progress removeObserver:self forKeyPath:@"paused"]; + [_progress removeObserver:self forKeyPath:@"fileTotalCount"]; + [_progress removeObserver:self forKeyPath:@"fileCompletedCount"]; + [_progress release]; + [super dealloc]; +} + - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change